﻿<!-- 正文开始 -->
<form id="modelCabConfigForm" lay-filter="modelCabConfigForm" class="layui-form model-form">
	<input name="id" type="hidden" />
	<div class="layui-form-item">
		<label class="layui-form-label">软件名称</label>
		<div class="layui-input-block">
			<input name="name" placeholder="请输入名称" value="#(cabConfig?cabConfig.name:'智能卷宗柜')" type="text"
				class="layui-input" maxlength="50" lay-verType="tips" lay-verify="required" required />
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">维护电话</label>
		<div class="layui-input-block">
			<input name="phone" placeholder="请输入电话" value="#(cabConfig?cabConfig.phone:'')" type="text"
				class="layui-input" maxlength="50" lay-verType="tips" lay-verify="required" required />
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">软件版权</label>
		<div class="layui-input-block">
			 <textarea name="copyright" placeholder="请输入软件版权" class="layui-textarea" maxlength="200">#(cabConfig?cabConfig.copyright:'昆明市公安局盘龙公安分局与云南赢中集团科技有限公司联合研制')</textarea>
		</div>
	</div>
	<div class="layui-form-item text-right">
		<button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
		<button class="layui-btn" lay-filter="submit-cab-config" lay-submit>保存</button>
	</div>
</form>

<script>
	layui.use(['layer', 'form', 'table', 'util', 'admin', 'config', 'element'], function() {
		var $ = layui.jquery;
		var layer = layui.layer;
		var form = layui.form;
		var table = layui.table;
		var util = layui.util;
		var admin = layui.admin;
		var config = layui.config;
		var config = layui.config;
		var element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
		form.render('select');
		var cabId = '#(cabId)';
		// 表单提交事件
		form.on('submit(submit-cab-config)', function(data) {
			layer.load(2);
			var formData = {};
			for (var key in data.field) {
				formData['cabConfig.' + key] = data.field[key];
			}
			formData['cabConfig.cabId'] = cabId;
			admin.req("biz/cab/config/save", formData, function(res) {
				layer.closeAll('loading');
				if (res.code == 200) {
					layer.closeAll();
					layer.msg(res.message, {
						icon: 1
					});
				} else {
					layer.msg(res.message, {
						icon: 2
					});
				}
			}, 'get');
			return false;
		});

	});
</script>